package com.bao.work.work02;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author baoye
 * @date 2024-08-14/19:02
 */
public class Student implements Serializable {
    private static final long serialVersionUID = 6277605187221189781L;
    private String classId;
    private Integer stuCount;
    private String stuId;
    private String name;
    private Date birth;
    private static final SimpleDateFormat SIMPLE_DATE_FORMAT= new SimpleDateFormat("yyyy-MM-dd");

    @Override
    public String toString(){
        return "Student{" +
                "classId='" + classId + '\'' +
                ", stuCount=" + stuCount +
                ", stuId='" + stuId + '\'' +
                ", name='" + name + '\'' +
                ", birth=" + SIMPLE_DATE_FORMAT.format(birth) +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        if (classId != null ? !classId.equals(student.classId) : student.classId != null) return false;
        if (stuCount != null ? !stuCount.equals(student.stuCount) : student.stuCount != null) return false;
        if (stuId != null ? !stuId.equals(student.stuId) : student.stuId != null) return false;
        if (name != null ? !name.equals(student.name) : student.name != null) return false;
        return birth != null ? birth.equals(student.birth) : student.birth == null;
    }

    @Override
    public int hashCode() {
        int result = classId != null ? classId.hashCode() : 0;
        result = 31 * result + (stuCount != null ? stuCount.hashCode() : 0);
        result = 31 * result + (stuId != null ? stuId.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (birth != null ? birth.hashCode() : 0);
        return result;
    }

    public String getClassId() {
        return classId;
    }

    public void setClassId(String classId) {
        this.classId = classId;
    }

    public Integer getStuCount() {
        return stuCount;
    }

    public void setStuCount(Integer stuCount) {
        this.stuCount = stuCount;
    }

    public String getStuId() {
        return stuId;
    }

    public void setStuId(String stuId) {
        this.stuId = stuId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public Student(String classId, Integer stuCount, String stuId, String name, Date birth) {
        this.classId = classId;
        this.stuCount = stuCount;
        this.stuId = stuId;
        this.name = name;
        this.birth = birth;
    }

    public Student() {
    }
}
